<html xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"  xmlns:p="http://primefaces.org/ui">

<f:view>
<f:loadBundle var="text" basename="#{suggestionForm.bundleName}"/>
<h:head>
    <title>#{text['suggestionForm.title']}</title>
    <meta name="menu" content="MainMenu"/>
    <meta name="heading" content="#{text['suggestionForm.heading']}"/>
</h:head>

<c:set var="delObject" value="#{text['suggestionList.suggestion']}"/>
<script type="text/javascript">
   var msgDelConfirm = "<h:outputFormat value="#{text['delete.confirm']}"><f:param value="#{delObject}" /></h:outputFormat>";
</script>

<div class="span3">
    <h2>#{text['suggestionForm.heading']}</h2>
    <p><h:outputText value="#{text['suggestionForm.message']}"/></p>
</div>
<div class="span7">

    <h:form id="suggestionForm" styleClass="well form-horizontal" autocomplete="off">
    
        
        <h:inputHidden value="#{suggestionForm.suggestion.id}" id="id" />

        <div class="control-group">
            <h:outputLabel styleClass="control-label" for="title" value="#{text['suggestion.title']}"/>
            <div class="controls">
                <h:inputText value="#{suggestionForm.suggestion.title}" id="title" required="true"/>
                <p:message for="title" />
            </div>
        </div>

        <div class="control-group">
            <h:outputLabel styleClass="control-label" for="description" value="#{text['suggestion.description']}"/>
            <div class="controls">
					<p:inputTextarea value="#{suggestionForm.suggestion.description}"
						id="description" required="true" rows="4" cols="50"
						counter="counter" maxlength="500"
						counterTemplate=" {0} #{text['suggestionForm.help.charactersRemaining']}" autoResize="false" />
						<h:outputText id="counter" />  
					<p:message for="description"/>
            </div>
        </div>

     	<div class="form-actions">
            <h:commandButton value="#{text['button.save']}" action="#{suggestionForm.save}" styleClass="btn btn-primary"/>
            
            <h:commandButton value="#{text['button.delete']}" action="#{suggestionForm.delete}" styleClass="btn" onclick="return confirmMessage(msgDelConfirm)" rendered="${not empty suggestionForm.suggestion.id}"/>
           
            <h:commandButton value="#{text['button.cancel']}" action="#{suggestionForm.cancel}" immediate="true" styleClass="btn" />
        </div>
        
	</h:form>
    
</div>
</f:view>
</html>
